<template>
  <div id="app">
    <el-container>
      <el-header>
        <div v-if="this.$route.path!=='/login'">
          <div v-if="identity!=='default'">
            <app-header v-if="identity==='normal'"></app-header>
            <agent-header v-if="identity==='agent'"></agent-header>
            <admin-dep v-if="identity==='admin_dep'"></admin-dep>
            <admin-co v-if="identity==='admin_co'"></admin-co>
          </div>
        </div>
      </el-header>
      <el-main><router-view/></el-main>
    </el-container>
  </div>
</template>
<script>
  import appHeader from './Header/Header'
  import agentHeader from  './Header/AgentHeader'
  import adminDep from './Header/AdminDep'
  import adminCo from './Header/AdminCo'
  import { mapState } from 'vuex'
  export default {
    name: 'App',
    data(){
      return {
        identity
      }
    },
    components:{
      appHeader,
      agentHeader,
      adminDep,
      adminCo
    },
    // computed:{
    //   ...mapState([
    //     // 'identity'
    //     'path'
    //   ])
    //  },
    mounted() {
      // this.identity = window.sessionStorage.getItem('identity')
      // console.log('identity:',this.identity)
      // console.log('当前路由',path)
      // this.path=this.$route.path
      // console.log(this.identity!=='default')
    },
    beforeCreate(){
      //在页面创建之前 获取identity
      this.identity = window.sessionStorage.getItem('identity')
      // this.path=this.$route.path
    }
  }
</script>
<style lang="less">
.el-header{
  background-color: #545c64;
}
</style>
